﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeBehind="ChangePassword.aspx.cs" Inherits="Imageo.ui.ChangePassword" %>

<%@ Register Src="../controls/TrailGMap.ascx" TagName="TrailGMap" TagPrefix="bintje" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContentPlaceholder" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContentPlaceholder" runat="Server">

    <script type="text/javascript">
        function checkPasswords() {
            var p1 = $("#<%=txtPass1.ClientID %>")[0];
            var p2 = $("#<%=txtPass2.ClientID %>")[0];
            var pold = $("#<%=txtPassOld.ClientID %>")[0];
            $('#trMinChars').hide();
            $('#trNotEqual').hide();

            $('#<%=btnChangePassword.ClientID %>').hide();
            if (p1.value.length < 6 || p2.value.length < 6) {
                $('#trMinChars').show();
                return;
            }
            if (p1.value!=p2.value) {
                $('#<%=btnChangePassword.ClientID %>').button();
                $('#trNotEqual').show();
                return;
            }
            if (pold.value.length < 6)
                return;
            
            $('#<%=btnChangePassword.ClientID %>').show();
        }

        $(document).ready(function() {
            $('#<%=btnChangePassword.ClientID %>').button();
            $("#<%=txtPass1.ClientID %>").keyup(function() {
                checkPasswords();
            });
            $("#<%=txtPass2.ClientID %>").keyup(function() {
                checkPasswords();
            });
            checkPasswords();
        });
    </script>

    <table id="tblChange" runat="server" width="100%">
        <tr valign="top">
            <td align="center">
                <div class="pnlCurvyWhite" style="width: 350px; margin: 20px; text-align: center;">
                    <span class="blueTitle">Change your password</span><br />
                    <br />
                    <div style="font-family: Verdana;">
                        <table>
                            <tr style="margin-bottom: 15px">
                                <td align="left">
                                    Old password:
                                </td>
                                <td>
                                    <asp:TextBox ID="txtPassOld" class="txtSearchBox" Style="color: Gray; font-size: 12px;
                                        margin: 2px; height: 20px; vertical-align: text-bottom;" runat="server" Width="200"  TextMode="Password"></asp:TextBox>
                                </td>
                            </tr>

                            <tr>
                                <td align="left">
                                    New password:
                                </td>
                                <td>
                                    <asp:TextBox ID="txtPass1" class="txtSearchBox" Style="color: Gray; font-size: 12px;
                                        margin: 2px; height: 20px; vertical-align: text-bottom;" runat="server" Width="200"  TextMode="Password"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td align="left">
                                    Confirm password:
                                </td>
                                <td>
                                    <asp:TextBox ID="txtPass2" class="txtSearchBox" Style="color: Gray; font-size: 12px;
                                        margin: 2px; height: 20px; vertical-align: text-bottom;" runat="server" Width="200" TextMode="Password"></asp:TextBox>
                                </td>
                            </tr>
                            <tr id="trMinChars">
                                <td colspan="2" style="color: Red; font-weight: bold;">
                                    Please enter at least 6 characters
                                </td>
                            </tr>

                            <tr id="trNotEqual">
                                <td colspan="2" style="color: Red; font-weight: bold;">
                                    The passwords are not the same
                                </td>
                            </tr>

                        </table>
                        <br />
                        <asp:Button ID="btnChangePassword" runat="server" Text="Change" OnClick="btnChangePassword_Click" />
                    </div>
                </div>
            </td>
        </tr>
    </table>
    <table id="tblDone" runat="server" width="100%" visible="false">
        <tr valign="top">
            <td align="center">
                <div class="pnlCurvyWhite" style="width: 350px; margin: 20px; text-align: center;">
                    <span class="blueTitle">Change your password</span><br />
                    <br />
                    <div style="font-family: Verdana;">
                        Your password has been changed!
                        <div>
                            <br />
                            <a runat="server" href="Home.aspx">Go to Home</a>
                        </div>
            </td>
        </tr>
    </table>
</asp:Content>
